﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/AdminCP/Views/Shared/ViewMasterPage1.Master"
    Inherits="System.Web.Mvc.ViewPage<InfoTech.Mvc.LanTranh.MucVu.Models.GIAODANModel>" %>

<%@ Import Namespace="InfoTech.LanTranh.MucVu.Service" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="content-box addGiaoDan">
        <div class="content-box-header">
            <h3>
                Thêm Giáo Dân</h3>
        </div>
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <%
                Html.EnableClientValidation(); %>
            <% 
                using (Html.BeginForm())
                {%>
            <%: Html.ValidationSummary() %>
            <table cellpadding="3" cellspacing="3">
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Giáo Dân
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Mã Giáo Dân
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.GIAODANID, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.GIAODANID, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Không Lưu Sổ
                    </td>
                    <td>
                        <%: Html.CheckBoxFor(c=>c.LUUSO) %>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Tên Thánh
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.TENTHANH, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.TENTHANH, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td width="10">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Đệm
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.HOVATENDEM, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.HOVATENDEM, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Tên
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.TEN, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.TEN, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Ngày Sinh
                    </td>
                    <td colspan="5">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.NGAYSINH,GIAODANService.Get_List_Days(), new { style = "width: 140px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.NGAYSINH, "(*)")%>
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.THANGSINH,GIAODANService.Get_List_Months(), new { style = "width: 145px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.THANGSINH, "(*)")%>
                                    </div>
                                </td>
                                <td>
                                    <div class="editor-field">
                                        <%: Html.DropDownListFor(model => model.NAMSINH,GIAODANService.Get_List_Years(), new { style = "width: 135px", @class="text-input" })%>
                                        <%: Html.ValidationMessageFor(model => model.NAMSINH, "(*)")%>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giới Tính
                    </td>
                    <td valign="middle">
                        <table>
                            <td>
                                <%:Html.RadioButtonFor(c=>c.GIOITINH,"False") %>
                            </td>
                            <td>
                                Nam
                            </td>
                            <td>
                                <%:Html.RadioButtonFor(c=>c.GIOITINH,"True") %>
                            </td>
                            <td>
                                Nữ
                            </td>
                        </table>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Dân Tộc
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DANTOC, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DANTOC, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Địa Chỉ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DIACHI, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DIACHI, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Điện Thoại
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.TextBoxFor(model => model.DIENTHOAI, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.DIENTHOAI, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Cha
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.HiddenFor(model => model.PARENTID)%>
                            <%: Html.TextBoxFor(model => model.TENCHA, new { style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.PARENTID, "(*)")%>
                            <%: Html.ValidationMessageFor(model => model.TENCHA, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        <img src="<%=Html.AreaImagesPath("AdminCP")%>search.png" style="cursor: pointer"
                            onclick="javascript:TimCha();" />
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Họ và Tên Mẹ
                    </td>
                    <td>
                        <div class="editor-field">
                            <%: Html.HiddenFor(model => model.MOTHERID)%>
                            <%: Html.TextBoxFor(model => model.TENME, new {style = "width: 200px", @class="text-input" })%>
                            <%: Html.ValidationMessageFor(model => model.MOTHERID, "(*)")%>
                            <%: Html.ValidationMessageFor(model => model.TENME, "(*)")%>
                        </div>
                    </td>
                    <td>
                        <img src="<%=Html.AreaImagesPath("AdminCP")%>search.png" style="cursor: pointer"
                            onclick="javascript:TimMe();" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Mục Vụ
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Phận
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%:Html.DropDownListFor(model => model.MAGIAOPHAN, GIAOPHANService.Get_List(),
                                                                              new { style = "width: 200px", @class = "text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%:Html.DropDownListFor(model => model.MAGIAOPHAN, GIAOPHANService.Get_List_Data(),
                                           new {style = "width: 200px", @class = "text-input"})%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOPHAN, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Hạt
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOHAT,GIAOHATService.Get_List_Join_GiaoPhan(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOHAT, GIAOHATService.Get_List_Join_GiaoPhan_Data(), new { style = "width: 200px", @class = "text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOHAT, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Xứ
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOXU,GIAOXUService.Get_List_Join_GiaoPhan_GiaoHat(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOXU,GIAOXUService.Get_List_Join_GiaoPhan_GiaoHat_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOXU, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Giáo Họ
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOHO,GIAOHOService.Get_List_Join_GiaoPhan_GiaoHat_GiaoXu(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAGIAOHO,GIAOHOService.Get_List_Join_GiaoPhan_GiaoHat_GiaoXu_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAGIAOHO, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="title" colspan="7">
                        Thông Tin Hành Chính &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Quốc Gia
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAQUOCGIA,QUOCGIAService.Get_List(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAQUOCGIA,QUOCGIAService.Get_List_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAQUOCGIA, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Tỉnh Thành
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MATINHTHANH,TINHTHANHService.Get_List_Join_Country(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MATINHTHANH,TINHTHANHService.Get_List_Join_Country_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MATINHTHANH, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                        Quận Huyện
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAQUANHUYEN,QUANHUYENService.Get_List_Join_City_Country(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAQUANHUYEN,QUANHUYENService.Get_List_Join_City_Country_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAQUANHUYEN, "(*)")%>
                        </div>
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        &nbsp;
                    </td>
                    <td align="right" class="cellTitle" valign="middle">
                        Xã Phường
                    </td>
                    <td>
                        <div class="editor-field">
                            <% if (Request.QueryString["Display"] != null)
                               {%>
                            <%: Html.DropDownListFor(model => model.MAXAPHUONG,XAPHUONGService.Get_List_Join_City_Country_District(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }
                               else
                               {%>
                            <%: Html.DropDownListFor(model => model.MAXAPHUONG,XAPHUONGService.Get_List_Join_City_Country_District_Data(), new { style = "width: 200px", @class="text-input" })%>
                            <%
                               }%>
                            <%: Html.ValidationMessageFor(model => model.MAXAPHUONG, "(*)")%>
                        </div>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="lineRow" colspan="7">
                    </td>
                </tr>
                <tr>
                    <td align="right" class="cellTitle" valign="middle">
                    </td>
                    <td>
                        <input type="submit" value="Thêm mới Giáo Dân" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                    </td>
                </tr>
            </table>
            <% } %>
        </div>
        <!-- End .content-box-content -->
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderCss" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">
    <script type="text/javascript" src="<%=Html.AreaScriptPath("AdminCP") %>MucVu.js"></script>
    <script type="text/javascript" src="<%=Html.AreaScriptPath("AdminCP") %>HanhChinh.js"></script>
    <script language="javascript" type="text/javascript">
        $(function () {
            $("#TENTHANH").autocomplete({
                    source: function( request, response ) {
				            $.ajax({
					                    url: "<%=Url.Action("DanhSachTenThanh","GiaDinhCongGiao") %>",
					                    dataType: "json",
					                    data: {						                      
						                    q: request.term
					                    },
					                    success: function( data ) {
						                    response( $.map( data, function( item ) {
							                    return {
								                    label: item.TENTHANH,
								                    value: item.TENTHANH
							                    }
						                    }));
					                    }
				            });
			        },
                    minLength: 0,
			        select: function( event, ui ) {
				        if(ui.item) {                            
                            $("#TENTHANH").val(ui.item.value);
                        }
			        },
			        open: function() {
                        selecting=true;
				        $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			        },
			        close: function() {
				        $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
                        selecting=false;
			        }
		    });
            $("#DANTOC").autocomplete({
                    source: function( request, response ) {
				            $.ajax({
					                    url: "<%=Url.Action("DanhSachDanToc","GiaDinhCongGiao") %>",
					                    dataType: "json",
					                    data: {						                      
						                    q: request.term
					                    },
					                    success: function( data ) {
						                    response( $.map( data, function( item ) {
							                    return {
								                    label: item.DANTOC,
								                    value: item.DANTOC
							                    }
						                    }));
					                    }
				            });
			        },
                    minLength: 0,
			        select: function( event, ui ) {
				        if(ui.item) {                            
                            $("#DANTOC").val(ui.item.value);
                        }
			        },
			        open: function() {
                        selecting=true;
				        $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
			        },
			        close: function() {
				        $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
                        selecting=false;
			        }
		    });       
            $("#MAGIAOPHAN").change(function(){
                Change_GiaoPhan('addGiaoDan','<%=Url.Action("Get_GIAOHAT","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });     
            $("#MAGIAOHAT").change(function(){
                Change_GiaoHat('addGiaoDan','<%=Url.Action("Get_GIAOXU","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });
            $("#MAGIAOXU").change(function(){
                Change_GiaoXu('addGiaoDan','<%=Url.Action("Get_GIAOHO","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });     
            $("#MAQUOCGIA").change(function(){
                Change_QuocGia('addGiaoDan','<%=Url.Action("Get_TINHTHANH","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });     
            $("#MATINHTHANH").change(function(){
                Change_TinhThanh('addGiaoDan','<%=Url.Action("Get_QUANHUYEN","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });
            $("#MAQUANHUYEN").change(function(){
                Change_QuanHuyen('addGiaoDan','<%=Url.Action("Get_XAPHUONG","GiaDinhCongGiao",new {area="AdminCP"}) %>',this.value);                
            });     
        });
        
        function TimCha()
        {
            Dialog('<%=Url.Action("TimPhuThan","GiaDinhCongGiao") %>','','Tìm Cha',1000,335,HideDialog,ClearData);
        }
        function TimMe()
        {
            Dialog('<%=Url.Action("TimPhuThan","GiaDinhCongGiao",new {id=1}) %>','1','Tìm Mẹ',1000,335,HideDialog,ClearData);
        }

        function Receive(type,id,value)
        {            
            if(type=="1"){
                document.getElementById('TENME').value = value;
                document.getElementById('MOTHERID').value = id;
            }
            else{
                document.getElementById('TENCHA').value = value;
                document.getElementById('PARENTID').value = id;
            }
        }
        function ClearData(type) {
            if(type=="1"){
                document.getElementById('TENME').value = '';
                document.getElementById('MOTHERID').value = '';
            }
            else{
                document.getElementById('TENCHA').value = '';
                document.getElementById('PARENTID').value = '';
            }
        }  
    </script>
</asp:Content>
